<?xml version="1.0"?> 
<xsl:stylesheet 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0"> 
  <xsl:output method="html"/> 
 
  <xsl:template match="/r/class"> 
	
	<table width="400px">
		<input type="hidden" name="id" id="id" value="{@id}" />
		<tr>
	        <td width="35%">Name:</td>
	        <td width="65%"><input id="name" name="name" value="{@name}"/></td>
	    </tr>
		<tr>
	        <td width="35%">isAbstract:</td>
	        <td width="65%">
	        	<xsl:if test="@isAbstract = 'True'">
	        		<input type="checkbox" id="isAbstract" name="isAbstract" value="1" checked="true" />isAbstract
	        	</xsl:if>
	        	<xsl:if test="@isAbstract != 'True'">
	        		<input type="checkbox" id="isAbstract" name="isAbstract" value="1" />isAbstract
	        	</xsl:if>
	        </td>
	    </tr>
	    <tr>
	        <td>superClass:</td>
	        <td>
	        	<a href="javascript:insertSuperClass('{@id}')">Insert superClass</a><br /><br />
	        	<div id="divSuperClass">
	        		<xsl:for-each select="./superClass">
	        			<xsl:variable name="idSuperClass" select="concat(@name, position())" /> 
	        			<div id="superClass{$idSuperClass}">
		        			<input type="hidden" name="superClass" id="$idSuperClass" value="{@id}" />
		        			<xsl:value-of select="@name" /> - <a href="javascript:deleteSuperClass('superClass{$idSuperClass}')">Delete</a><br />
		        		</div>
	        		</xsl:for-each>
	        	</div>
			</td>
	    </tr>
	    <tr>
	        <td>ownedAtrribute:</td>
	        <td>
	        	<ul>
	        		<xsl:for-each select="./ownedAttribute">
	        			<li><xsl:value-of select="@name" /></li>
	        		</xsl:for-each>
        		</ul>
			</td>
	    </tr>
	    <tr>
	        <td>ownedOperation:</td>
	        <td>
	        	<ul>
	        		<xsl:for-each select="./ownedOperation">
	        			<li><xsl:value-of select="@name" /></li>
	        		</xsl:for-each>
        		</ul>
			</td>
	    </tr>
		<tr>
	        <td>package:</td>
	        <td>
    			<xsl:value-of select="@package" />
			</td>
	    </tr>	    
		<tr>
	        <td>ownedComment:</td>
	        <td>
	        	<xsl:for-each select="./ownedComment">
	        		<xsl:value-of select="@id" />:
	        		<p><xsl:value-of select="@body" /></p>
    			</xsl:for-each>
			</td>
	    </tr>	    
		<tr>
	        <td>tag</td>
	        <td>
	        	<xsl:for-each select="./tag">
	        		<p><xsl:value-of select="@name" />: <xsl:value-of select="@value" /></p>
    			</xsl:for-each>
			</td>
	    </tr>	    
	    <tr>
	        <td>Insert new elements:</td>
	        <td>
	        	<a href="javascript:createProperty('{@id}')">Attribute</a><br />
	        	<a href="javascript:createOperation('{@id}')">Operation</a><br />
	        	<a href="javascript:createComment('{@id}')">Comment</a><br />
	        	<a href="javascript:createTag('{@id}')">Tag</a><br />
			</td>
	    </tr>
	    <tr>
	        <td colspan="2" align="center"><button onclick="javascript:saveClass('{@id}')">Save</button></td>
	    </tr>
	</table>
	<script type="text/javascript">
		qtSuperClass = parseInt('{count(./superClass)}')
	</script>
	</xsl:template>  
</xsl:stylesheet> 
